#ifndef QUEUEWIDGET_H
#define QUEUEWIDGET_H

/**
Nectarine Utility Project is a software interface for the web system 'demovibes'
Copyright (C) 2010  Alexandre LAURENT

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.

website: http://code.google.com/p/nectarine-utility-project/
e-mail: lw.demoscene@gmail.com
**/

#include <QWidget>
#include <QList>

#include "../Types/songrequest.h"
#include "songlistwidget.h"
#include "songrequestwidget.h"

class QFrame;
class QVBoxLayout;
class QGroupBox;
class QBoxLayout;
class QLabel;

class QueueWidget : public QWidget
{
    Q_OBJECT

private:

    QVBoxLayout* pVerticalBox;

    SongRequestWidget* pSongRequestWidget;

    QGroupBox* pQueueGBox;
    QBoxLayout* pQueueLayout;
    SongListWidget* pQueueList;

    QGroupBox* pHistoryGBox;
    QBoxLayout* pHistoryLayout;
    SongListWidget* pHistoryList;

    // Data to display
    SongRequest playingSong;
    QList<SongRequest> queueData;
    QList<SongRequest> historyData;


    void fillPlayingSong(void);
    void fillQueue(void);
    void fillHistory(void);

public:
    QueueWidget(QWidget* parent = 0);
    ~QueueWidget(void);

    void setData(const SongRequest& playingSong, const QList<SongRequest>& queueData, const QList<SongRequest>& historyData);
    void setPlayingSong(const SongRequest& playingSong);
    void setQueueData(const QList<SongRequest>& queueData);
    void setHistoryData(const QList<SongRequest>& historyData);

    unsigned int getTimeLeftBeforeNextSong(void)const { return playingSong.timeLeft; }
    unsigned int getUserRequestCount(const QString& username)const;

    SongRequestWidget* getSongRequestWidget(void) { return pSongRequestWidget; }
    SongListWidget* getRequestListWidget(void) { return pQueueList; }
    SongListWidget* getHistoryListWidget(void) { return pHistoryList; }

    void setConnection(const bool isConnected);
};

#endif // QUEUEWIDGET_H
